#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

void func(int arr[10], int sz)
{
	int* left = arr;
	int* right = &arr[sz - 1];
	while (left <= right)
	{
		while (*left % 2 == 1)
		{
			left++;
		}
		while (*right % 2 == 0)
		{
			right--;
		}
		if (left <= right)
		{
			int tmp = *left;
			*left = *right;
			*right = tmp;
		}
	}
}

int main()
{
	int arr[10] = { 0 };
	int i = 0;
	//初始化数组
	for (i = 0; i < 10; i++)
	{
		arr[i] = i + 1;
	}
	int sz = sizeof(arr) / sizeof(arr[0]);
	func(arr, sz);
	for (i = 0; i < 10; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}